home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / kdbx.man < prev    next >
Encoding:
Text File  |  1990-10-25  |  9.5 KB  |  267 lines

  1.  
  2.  
  3.  
  4. KDBX                      User Commands                      KDBX
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      kdbx - Sprite debugger
  12.  
  13. SSYYNNOOPPSSIISS
  14.      kdbx [ -ip ] [ -I _d_i_r  ]  [  -c  _f_i_l_e  ]  [  -h  _h_o_s_t_n_a_m_e  ]
  15.      [_o_b_j_f_i_l_e]
  16.  
  17. _________________________________________________________________
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      kdbx is a debugger which can be used  to  debug  the  Sprite
  21.      kernel.   kdbx is nearly identical to dbx.  The only differ-
  22.      ence is the relationship between the debugger (kdbx) and the
  23.      debuggee  (the kernel).  This manual page describes how kdbx
  24.      must be used differently because of the different  debugging
  25.      relationship.   Since  kdbx accepts all options and commands
  26.      of dbx, these are not described in this manual page.  A com-
  27.      plete  reference  of  all  of  the  options and the commands
  28.      accepted by kdbx is contained in dbx(1).
  29.  
  30. SSttaarrttiinngg uupp KKddbbxx
  31.      The Sprite debugging facilities are broken into two  pieces:
  32.      the  piece which resides in the Sprite kernel and kdbx which
  33.      runs on a Unix machine.  The Sprite kernel and kdbx communi-
  34.      cate  across a serial line or the ethernet.  In order to use
  35.      kdbx on the kernel, the  kernel  must  be  forced  into  the
  36.      debugging  routine so that it can communicate to kdbx.  Once
  37.      this is accomplished, kdbx can be used on  the  kernel  just
  38.      like dbx can be used on a normal stopped process.  Thus, the
  39.      normal two step sequence needed to startup kdbx on the  ker-
  40.      nel is:
  41.  
  42.      1)   Force the  kernel  into  the  debugging  routine.   The
  43.           method of accomplishing this will be explained below.
  44.  
  45.      2)   Invoke kdbx like dbx.  For example, the normal  command
  46.           would  be  ``kdbx  -I  ../Installed/mod.o  -h  hostname
  47.           sprite''.
  48.  
  49.      It is also possible to invoke ``kdbx -p  ...''  to  indicate
  50.      that  kdbx  should read the symbol table but prompt the user
  51.      before communicating with the Sprite kernel.  In this  case,
  52.      kdbx  may be invoked before Sprite enters the debugger, thus
  53.      overlapping some of the overhead of booting and debugging.
  54.  
  55.      By default kdbx uses the serial  line  for  debugging.   The
  56.      kernel  on the other hand defaults to the network.  In order
  57.      to have kdbx use the network the -h flag  must  be  used  in
  58.      order  to  specify  the  name  of  the  host  that  is to be
  59.      debugged.  There are two methods of making the sprite kernel
  60.      use the serial line instead of the network.  First, the L1-B
  61.      key described below can be used.  Second, the kernel can  be
  62.  
  63.  
  64.  
  65. Sprite v.1.0       Printed:  October 25, 1990                   1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. KDBX                      User Commands                      KDBX
  73.  
  74.  
  75.  
  76.      recompiled  with  the _d_b_g__R_s_2_3_2_D_e_b_u_g flag set to TRUE (it is
  77.      set to FALSE by the dbg module by  default).   This  can  be
  78.      done  in the mainHook.c file that is in each kernel's direc-
  79.      tory.
  80.  
  81.      There are several different ways to force  the  kernel  into
  82.      the  debugging  routine.   The  first method of entering the
  83.      debugging routine is by an  unhandled  exception  which  the
  84.      operating  system  encountered.   If  this  happens  then no
  85.      further manipulation of the kernel is required and kdbx  can
  86.      be invoked directly.  The second method is by putting a call
  87.      to the debugger in the operating system code.  This is  done
  88.      by  including  dbg.h  and entering the macro DBG_CALL at the
  89.      point where you wish the debugger to be called.  An  example
  90.      piece of C code which uses this macro is
  91.  
  92.           Sys_Printf("Kernel foobared");
  93.           DBG_CALL;
  94.  
  95.  
  96.      If this method is used, then kdbx can be invoked directly.
  97.  
  98.      If the kernel is not already in the debugging routine,  then
  99.      it  must  be  interrupted and forced into the debugging rou-
  100.      tine.  The easiest way to do this is to  type  LL11--DD  at  the
  101.      console of the kernel being debugged.  This will immediately
  102.      force the kernel into the debugger and kdbx can  be  invoked
  103.      on  the kernel.  In this case the debugger will use the net-
  104.      work regardless of the value of the _d_b_g__R_s_2_3_2_D_e_b_u_g flag.  In
  105.      order to use the serial line use LL11--BB instead.
  106.  
  107.      Another simple way of forcing the kernel into  the  debugger
  108.      is  to  issue the command ``l1d hostname'' which will send a
  109.      debug message to the kernel.
  110.  
  111.      A more complicated method of forcing  the  kernel  into  the
  112.      debugger is:
  113.  
  114.      1)   Type an  LL11--AA  at  the  console  of  the  kernel  being
  115.           debugged.   After  typing this the program counter (PC)
  116.           where the kernel was interrupted will be printed out.
  117.  
  118.      2)   Type the command LL aa0044000088 _a_d_d_r where  _a_d_d_r  is  the  PC
  119.           that was printed out in step 1.
  120.  
  121.      3)   Type the command CC aa0044000066.
  122.  
  123.      After this last step the  kernel  debugger  will  have  been
  124.      entered and kdbx can now be invoked on the kernel.
  125.  
  126. UUssiinngg KKddbbxx
  127.      Once kdbx has been invoked on the  kernel  it  can  be  used
  128.  
  129.  
  130.  
  131. Sprite v.1.0       Printed:  October 25, 1990                   2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. KDBX                      User Commands                      KDBX
  139.  
  140.  
  141.  
  142.      almost  exactly  like dbx.  All of the commands that work in
  143.      dbx will also work in kdbx  (i.e.  setting  of  breakpoints,
  144.      single stepping, tracing, printing of variables, etc.).  The
  145.      only difference  when  using  kdbx  is  if  after  typing  a
  146.      ``cont''  command  you  wish  to interrupt the kernel to get
  147.      back into kdbx.  When using normal dbx a  control-C  can  be
  148.      typed  at  the  terminal  to interrupt the debugged process.
  149.      This will not work with kdbx.  In  order  to  interrupt  the
  150.      kernel you must use the same method that was given above for
  151.      entering the kernel  debugging  routine  from  the  console.
  152.      Once this is done then kdbx will get the interrupt.
  153.  
  154. QQuuiittttiinngg KKddbbxx
  155.      Kdbx can be exited just like dbx;  that  is,  by  using  the
  156.      ``quit''  command.   When  kdbx  is  exited  the kernel will
  157.      resume where kdbx tells it to resume.
  158.  
  159. AAddddiittiioonnss ttoo KKddbbxx
  160.      The part of the debugger which resides in the Sprite  kernel
  161.      saves  the  state of the kernel when it is entered.  Kdbx is
  162.      aware of part of this state (such as the program counter and
  163.      the general purpose registers) but is unaware of most of it.
  164.      In order to get at this information the variables which con-
  165.      tain  this  information  can be printed out in kdbx by using
  166.      the normal print command.  These variables include:
  167.  
  168.      dbgSfcReg
  169.           The source function code register.
  170.  
  171.      dbgDfcReg
  172.           The destination function code register.
  173.  
  174.      dbgUserContext
  175.           The user context register.
  176.  
  177.      dbgKernelContext
  178.           The kernel context register.
  179.  
  180.      dbgTrapStack
  181.           The stack  that  was  created  when  the  debugger  was
  182.           entered.   This  includes  the  bus error register, the
  183.           user stack pointer, the 16 general purpose registers in
  184.           the  order  d0-d7, a0-a7, and the exception stack.  The
  185.           exception stack includes the pc and the  status  regis-
  186.           ter.  See the header file exc.h for the exact format of
  187.           the trap stack and the exception stack.
  188.  
  189.      In the normal case kdbx will only backtrace the stack of the
  190.      process  that  was  executing when the debugger was entered.
  191.      If you wish to backtrace the stack  of  some  other  waiting
  192.      process then go through the following steps:
  193.  
  194.  
  195.  
  196.  
  197. Sprite v.1.0       Printed:  October 25, 1990                   3
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. KDBX                      User Commands                      KDBX
  205.  
  206.  
  207.  
  208.      1)   Enter the command ``set $index =  process-table-index''
  209.           where  process-table-index  is the index of the process
  210.           control block of the process whose stack  you  want  to
  211.           trace.
  212.  
  213.      2)   Now issue the normal ``where'' command.
  214.  
  215.      3)   Go back to the original process by issuing the  command
  216.           ``set $index = 0''.
  217.  
  218.      Note that the only command that  should  be  executed  after
  219.      switching  processes  is  the where command.  Continuing the
  220.      kernel after switching stacks would be a disaster.
  221.  
  222. MMooddiiffiiccaattiioonnss ttoo KKddbbxx
  223.      There have been several modifications to kdbx:
  224.  
  225.      1)   Parameter types are not checked when calling  functions
  226.           inside of kdbx.
  227.  
  228.      2)   Objects  of  type  ``char  *''  are  not   dereferenced
  229.           automatically.   There  are  two  ways  to make them be
  230.           dereferenced while using the ``print'' command.  One is
  231.           to issue the command ``ps'' (an alias for print string)
  232.           instead of ``print''.  The other  is  to  automatically
  233.           set  the  variable  $dref  (i.e.  use the command ``set
  234.           $dref'').  This will make all subsequent ``print'' com-
  235.           mands dereference strings.
  236.  
  237. BBUUGGSS
  238.      A good chunk of this man page is out of date.  We  currently
  239.      only use kdbx on Decstation 3100s.  Other machines use kgdb,
  240.      and we plan to switch 3100s  to  kgdb,  too.   Look  at  the
  241.      script /sprite/src/kernel/sprite/Kdbx for the correct way to
  242.      invoke kdbx.
  243.  
  244. SSEEEE AALLSSOO
  245.      dbx, kgdb
  246.  
  247. KKEEYYWWOORRDDSS
  248.      debugger, dbx, sprite debugger, kernel debugger
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263. Sprite v.1.0       Printed:  October 25, 1990                   4
  264.  
  265.  
  266.  
  267.